<?php
/**
 * csmbol bookingdata Model for csmbol Component
 * 
 * @package    Joomla.csmbol
 * @subpackage Components
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_2
 * @license    GNU/GPL
 */
 
// No direct access
 
defined( '_JEXEC' ) or die( 'Restricted access' );
 
jimport( 'joomla.application.component.model' );

require_once( JPATH_COMPONENT.DS.'models/linklist.php' );

/**
 * csmbol bookingdata Model
 *
 * @package    Joomla.csmbol
 * @subpackage Components
 */
class csmbolModelbookingdata extends JModel
{
	//the bookingdata model holds the booking data in a link list data structure
	public $datetimebox_list;

	//UI-related properties
	public $first_box;	
	//resp file content, read only once
	public $resp_file_content;
    
	function __construct(){

		$this->datetimebox_list = new DateTimeBoxList();
		$this->first_box = true;		
		$this->resp_file_content = NULL;
		//important: without this line the model object will not create 
		parent::__construct(); 			
	}
	public function getFirstBox(){
		return $this->first_box;
	}
	public function setFirstBox($isfirst){
		$this->first_box = $isfirst;
	}	
	public function getDateTimeBoxList(){
		return $this->datetimebox_list;
	}
	public function setDateTimeBoxList($datetimebox_list){
		$this->datetimebox_list = $datetimebox_list;
	}	
	public function getRespFileContent(){
		return $this->resp_file_content;
	}
	public function setRespFileContent($resp_file_content){
		$this->resp_file_content = $resp_file_content;
	}	
}

// Per date booking data
class BookingData{
    /* interal id of the booking date */
    public $date_id;

	public $booking_date;
	public $time_slot;

	/* reseved for custom time frame */
	public $start_time;
	public $end_time;	

	//list of property accesser 		
	public function getDateId(){
		return $this->date_id;
	}
	public function setDateId($date_id){
		$this->date_id = $date_id;
	}
    
	function __construct(){
		
		$this->date_id = 1;

		$this->booking_date = NULL;

		$this->datetimebox_list = NULL;
		$this->datetimebox = NULL;
		$this->time_slot = array("am"=>false, "pm"=>false, "ev"=>false);	
	}		
}

class DateTimeBox extends ListNode{
	//booking data encapsulated   
	public $data;
	
    /* Node constructor */
    function __construct()
    {
		$this->data = new BookingData();
        $this->next = NULL;
    }
	
	public function getData(){
		return $this->data;
	}
	public function setData($data){
		$this->data = $data;
	}	
}

class DateTimeBoxList extends LinkList{
	
	
}
